package com.ocom.payhandle.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.payconfig.EntityXfZoneDate;
import com.ocom.common.vo.pyhandle.ConsTimeZoneVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface IDaoXfZoneDate extends BaseMapper<EntityXfZoneDate> {

	/**
	 * select 	d.zone_no , z.zone_name
	 * 			from 	xf_time_zone z , xf_zone_date d
	 * 				where 	d.com_id = @companyID 	and 	z.com_id = @companyID
	 * 						and 	d.day_date = 0 	and 	d.date = @day
	 * 						and 	d.zone_no = z.zone_no
	 * @param comId
	 * @param day
	 * @return
	 */
	@Select({"<script> \n",
			"select d.zone_no as consTimeZone,z.zone_name \n" +
					"from xf_zone_date d \n" +
					"left join xf_time_zone z on d.com_id=z.com_id and d.zone_no=z.zone_no \n" +
					"where d.com_id =#{comId} and d.day_date = 0 and  d.date = #{day} "+
					"</script>"}
	)
	public ConsTimeZoneVo getTimeZoneDay(@Param("comId")Long comId, @Param("day")Integer day);


	/**
	 * select 	d.zone_no , z.zone_name
	 * 			from 	xf_time_zone z , xf_zone_date d
	 * 				where 	d.com_id = @companyID 	and 	z.com_id = @companyID
	 * 						and 	d.day_date = 1 	and 	d.date = @date
	 * 						and 	d.zone_no = z.zone_no
	 * @param comId
	 * @param date
	 * @return
	 */
	@Select({"<script> \n",
			"select d.zone_no as consTimeZone,z.zone_name \n" +
					"from xf_zone_date d  \n" +
					"left join xf_time_zone z on d.com_id=z.com_id and d.zone_no=z.zone_no  \n" +
					"where d.com_id =#{comId} and d.day_date = 1  and  d.date = #{date} "+
					"</script>"})
	public ConsTimeZoneVo getTimeZoneDate(@Param("comId")Long comId, @Param("date")String date);
}
